package com.example.demo;

public class Hello {
    private static boolean isEven(int a) {
        return (a & 1) == 0;
    }

    public static void main(String[] args) {
        String s = "aaaaFE01aaaaFE01E01aaaa";
        int fe01Index = 0;
        while (fe01Index > -1) {
            fe01Index = s.indexOf("FE01", fe01Index);
            if (isEven(fe01Index)) {
                s = s.replaceFirst("FE01", "FF");
            }
            if (fe01Index != -1) {
                fe01Index++;
            }
        }
        System.out.println(s);
    }
}
